<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <!--
  First page of the css coverage test.
  * Contains page2 in an iframe
  * Forwards to page2 on a timeout
  -->
  <title>Page 1</title>
  <style>
    @import url(browser_cmd_csscoverage_sheetD.css);
    /* This should match below */
    .page1-test1 {
      color: #011;
    }
    /* This should not match below */
    .page1-test2 {
      color: #012;
    }
    /* This would match if the mouse was in the right place */
    .page1-test3:hover {
      color: #013;
    }
    /* This can't match because it's illegal */
    .page1-test4:broken {
      color: #014;
    }
    /* This doesn't match until the event fires */
    .page1-test5 {
      color: #015;
    }
    /* TODO: include examples of all CSS rules in
    https://developer.mozilla.org/en-US/docs/Web/API/CSSRule
    and include tests for rules nested in media rules, etc */

    /* We're not testing unparable CSS right now */
  </style>
  <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetA.css">
  <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetB.css">
  <script type="application/javascript;version=1.8">
  /* How quickly do we rush through this? */
  let delay = 500;
  window.addEventListener("load", () => {
    dump('TEST-INFO | load from browser_cmd_csscoverage_page1.html\n');
    setTimeout(() => {
      dump('TEST-INFO | timeout from browser_cmd_csscoverage_page1.html\n');
      /* This adds <div class=page1-test5></div> */
      let parent = document.querySelector("#page1-test5-holder");
      let child = document.createElement("div");
      child.classList.add("page1-test5");
      parent.appendChild(child);

      /* Then navigate to the next step */
      window.location.href = "browser_cmd_csscoverage_page3.html"
    }, delay);
  });
  </script>
</head>
<body>

<h2>Page 1</h2>

<div class=page1-test1>.page1-test1</div>
<div class=page1-test3>.page1-test3</div>

<div id=page1-test5-holder></div>

<div class=sheetA-test1>.sheetA-test1</div>
<div class=sheetA-test3>.sheetA-test3</div>
<div class=sheetB-test1>.sheetB-test1</div>
<div class=sheetB-test3>.sheetB-test3</div>
<div class=sheetC-test1>.sheetC-test1</div>
<div class=sheetC-test3>.sheetC-test3</div>
<div class=sheetD-test1>.sheetD-test1</div>
<div class=sheetD-test3>.sheetD-test3</div>

<iframe src=browser_cmd_csscoverage_page2.html></iframe>

<p>
  <a href="browser_cmd_csscoverage_page3.html">Page 3</a>
</p>

</body>
</html>
